
#include<iostream>
#include<sys/types.h>
#include<sys/stat.h>
#include"comm.hpp"
#include<cstring>
#include<fcntl.h>
#include<cerrno>
#include<unistd.h>
#include<cstdio>
#include<cassert>
int main()
{
    int wfd=open(fifoname.c_str(),O_WRONLY);
    if(wfd<0)
    {
        std::cerr<<errno<<":"<<strerror(errno)<<std::endl;
        return 1;
    }
    char buffer[NUM];
    while(true)
    {
        std::cout<<"请输入"<<std::endl;
        char *msg=fgets(buffer,sizeof(buffer),stdin);
        assert(msg);
        (void)msg;
        buffer[strlen(buffer)-1]=0;


        ssize_t n=write(wfd,buffer,strlen(buffer));
        assert(n>0);
        (void)n;

    }
    close(wfd);
}